const { defineConfig } = require('@vue/cli-service')
const path = require('path')
const BASE_URL = process.env.NODE_ENV === "production" ? "/fresh-rabbit/" : "./";
module.exports = defineConfig({

  publicPath: BASE_URL,
  // outputDir: 'dist',
  // assetsDir: 'static',
  // # 这个是设置外部扩展，模块为qc变量名为QC，导入qc将不做打包。
  configureWebpack: {
    externals: {
      qc: 'QC'
    }
  },
  devServer: {
    historyApiFallback: true,
    allowedHosts: "all",
  },
  transpileDependencies: true,
  lintOnSave: false,
  chainWebpack: (config) => {

    // config.devServer.disableHostCheck(true)


    const oneOfsMap = config.module.rule("less").oneOfs.store;
    oneOfsMap.forEach(item => {
      item
        .use("style-resources-loader")
        .loader("style-resources-loader")
        .options({
          // 这里的路径不能使用 @ 符号，否则会报错
          // patterns: ["./src/assets/reset1.less", "./src/assets/reset2.less"]
          patterns: [
            path.resolve(__dirname, './src/assets/styles/variables.less'),
            path.resolve(__dirname, './src/assets/styles/mixins.less')
          ]
        })
        .end()
    })
  }




})
